//
//  DoggyService.swift
//  MVP_Demo
//
//  Created by mac on 2017/7/28.
//  Copyright © 2017年 LLyan. All rights reserved.
//

import Foundation

typealias Result = ([Dog]) -> Void

class DoggyService {
    
    func deliverDoggies(_ result: @escaping Result) {
        let firstDoggy = Dog(name:"Alfred", breed:Breed.labrador.rawValue, age:1)
        let secondDoogy = Dog(name:"Vinny", breed:Breed.doberman.rawValue, age:2)
        let thirdDoogy = Dog(name: "Lucky", breed:Breed.labrador.rawValue, age: 3)
        
        let delay =  DispatchTime.now() + Double(Int64(Double(NSEC_PER_SEC)*2)) / Double(NSEC_PER_SEC)
        
        DispatchQueue.main.asyncAfter(deadline: delay) { 
            result([firstDoggy, secondDoogy, thirdDoogy])
        }
        
    }
    
}
